package pers.xx.sbm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import pers.xx.sbm.service.DyReportDataService;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 德育市级报告
 */
@Controller
@RequestMapping("/dyReportData")
public class DyReportDataController {

    @Autowired
    private DyReportDataService dyReportDataService;

    @RequestMapping("/demo1")
    @ResponseBody
    public Object demo1(){
        int i = 1 / 0;
        return new Date();
    }

    /**
     * 市级接口
     *
     * @return
     */
    @RequestMapping(value = "/getData", method = RequestMethod.GET)
    @ResponseBody
    public Map<String, Object> getData() {
        Map result = new HashMap<>();

        int studentNumber = dyReportDataService.getNumbers("");
        result.put("studentNumber",studentNumber);

        int primaryStudentNumber = dyReportDataService.getNumbers("小学");
        result.put("primaryStudentNumber",primaryStudentNumber);

        int juniorStudentNumber = dyReportDataService.getNumbers("初中");
        result.put("juniorStudentNumber",juniorStudentNumber);

        int seniorStudentNumber = dyReportDataService.getNumbers("高中");
        result.put("seniorStudentNumber",seniorStudentNumber);

        String allSituationTxt = dyReportDataService.getAllSituationTxt();
        result.put("allSituationTxt",allSituationTxt);


        Map<Integer, List<Object>> allSituationScore = dyReportDataService.getAllSituationScore();
        result.put("allSituationScore",allSituationScore);

        String primaryDcdAllSituationTxt = dyReportDataService.getDcdAllSituationTxtByXd("小学");
        result.put("primaryDcdAllSituationTxt",primaryDcdAllSituationTxt);


        Map<Integer, List<Object>> primaryDcdAllSituationScore = dyReportDataService.getDcdAllSituationScoreByXd("小学");
        result.put("primaryDcdAllSituationScore",primaryDcdAllSituationScore);

        List<Map<String, Object>> primaryTestContent = dyReportDataService.getTestContentByXd("小学");
        result.put("primaryTestContent",primaryTestContent);

        List<Map<String, Object>> primaryCompareTxt = dyReportDataService.getCompareTxtByXd("小学");
        result.put("primaryCompareTxt",primaryCompareTxt);

        List<Map<String, Object>> primaryCompareData = dyReportDataService.getCompareDataByXd("小学");
        result.put("primaryCompareData",primaryCompareData);

        String juniorDcdAllSituationTxt = dyReportDataService.getDcdAllSituationTxtByXd("初中");
        result.put("juniorDcdAllSituationTxt",juniorDcdAllSituationTxt);


        Map<Integer, List<Object>> juniorDcdAllSituationScore = dyReportDataService.getDcdAllSituationScoreByXd("初中");
        result.put("juniorDcdAllSituationScore",juniorDcdAllSituationScore);

        List<Map<String, Object>> juniorTestContent = dyReportDataService.getTestContentByXd("初中");
        result.put("juniorTestContent",juniorTestContent);

        List<Map<String, Object>> juniorCompareTxt = dyReportDataService.getCompareTxtByXd("初中");
        result.put("juniorCompareTxt",juniorCompareTxt);

        List<Map<String, Object>> juniorCompareData = dyReportDataService.getCompareDataByXd("初中");
        result.put("juniorCompareData",juniorCompareData);


        String seniorDcdAllSituationTxt = dyReportDataService.getDcdAllSituationTxtByXd("高中");
        result.put("seniorDcdAllSituationTxt",seniorDcdAllSituationTxt);


        Map<Integer, List<Object>> seniorDcdAllSituationScore = dyReportDataService.getDcdAllSituationScoreByXd("高中");
        result.put("seniorDcdAllSituationScore",seniorDcdAllSituationScore);

        List<Map<String, Object>> seniorTestContent = dyReportDataService.getTestContentByXd("高中");
        result.put("seniorTestContent",seniorTestContent);

        List<Map<String, Object>> seniorCompareTxt = dyReportDataService.getCompareTxtByXd("高中");
        result.put("seniorCompareTxt",seniorCompareTxt);

        List<Map<String, Object>> seniorCompareData = dyReportDataService.getCompareDataByXd("高中");
        result.put("seniorCompareData",seniorCompareData);

        return result;
    }
}
